import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [{
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'Home',
    meta: {
      isFootShow: true
    },
    component: () => import('@/views/home/index')
  },

  //首页相关
  {
    path: '/home/city',
    name: 'city',
    meta: {
      isFootShow: false
    },
    component: () => import('@/views/home/city/index')
  },
  {
    path: '/home/branddetail',
    name: 'branddetail',
    meta: {
      isFootShow: false
    },
    component: () => import('@/views/home/branddetail/index')
  },
  {
    path: '/home/newhotgoods',
    name: 'newhotgoods',
    meta: {
      isFootShow: false
    },
    component: () => import('@/views/home/newhotgoods/index')
  },
  {
    path: '/home/goodsinfo',
    name: 'goodsinfo',
    meta: {
      isFootShow: false
    },
    component: () => import('@/views/home/goodsinfo/index')
  },
  {
    path: '/home/search',
    name: 'search',
    meta: {
      isFootShow: false
    },
    component: () => import('@/views/home/search/index')
  },
  {
    path: '/home/brandlist',
    name: 'brandlist',
    meta: {
      isFootShow: false
    },
    component: () => import('@/views/home/brandlist/index')
  }





  /*

  @click="togoodsinfo(item.id)"

  //到商品详细页
    togoodsinfo(goodsid) {
      console.log(goodsid);
      this.$router.push({
        name: "goodsinfo",
        params: {
          id: goodsid,
        },
      });
    },



  */







  ,
  {
    path: '/car',
    name: 'car',
    meta: {
      isFootShow: true
    },
    component: () => import('../views/car/index')
  },

  {
    path: '/car/order',
    name: 'order',
    meta: {
      isFootShow: false
    },
    component: () => import('../views/car/order/index')
  }, {
    path: '/car/caraddress',
    name: 'caraddress',
    meta: {
      isFootShow: false
    },
    component: () => import('../views/car/caraddress/index')
  },


















  {
    path: '/category',
    name: 'category',
    meta: {
      isFootShow: true
    },
    component: () => import('../views/category/index')
  }, {
    path: '/category/categorylist',
    name: 'categorylist',
    meta: {
      isFootShow: true
    },
    component: () => import('../views/category/categorylist/index')
  },
  {
    path: '/category/categorysort',
    name: 'categorysort',
    meta: {
      isFootShow: true
    },
    component: () => import('../views/category/categorysort/index')
  },




  {
    path: '/my',
    name: 'my',
    meta: {
      isFootShow: true
    },
    component: () => import('../views/my/index')
  }, {
    path: '/my/collect',
    name: 'collect',
    meta: {
      isFootShow: false
    },
    component: () => import('../views/my/collect/index')
  }, {
    path: '/my/address',
    name: 'address',
    meta: {
      isFootShow: false
    },
    component: () => import('../views/my/address/index')
  }, {
    path: '/my/address/addaddress',
    name: 'addaddress',
    meta: {
      isFootShow: false
    },
    component: () => import('@/views/my/address/addaddress/index')
  }, {
    path: '/my/address/editaddress',
    name: 'editaddress',
    meta: {
      isFootShow: false
    },
    component: () => import('@/views/my/address/editaddress/index')
  },
  {
    path: '/my/fadeback',
    name: 'fadeback',
    meta: {
      isFootShow: false
    },
    component: () => import('../views/my/fadeback/index')
  },








  {
    path: '/topic',
    name: 'topic',
    meta: {
      isFootShow: true
    },
    component: () => import('../views/topic/index')
  },
  {
    path: '/topic/topicdetail',
    name: 'topicdetail',
    meta: {
      isFootShow: false
    },
    component: () => import('../views/topic/topicdetail/index')
  }
]

const router = new VueRouter({
  routes,
  scrollBehavior(to, from, savedPosition) {
    return new Promise((resolve, reject) => {
      setTimeout(() => {
        resolve({
          x: 0,
          y: 0
        })
      }, 500)
    })
  }
})

export default router